@model HomePortal.Models.Comment

@* This partial view defines form fields that will appear when creating and editing entities *@

<div class="editor-label">
    @Html.LabelFor(model => model.UserName)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.UserName)
    @Html.ValidationMessageFor(model => model.UserName)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.CommentText)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.CommentText)
    @Html.ValidationMessageFor(model => model.CommentText)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.Rating)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Rating)
    @Html.ValidationMessageFor(model => model.Rating)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.CommentDate)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.CommentDate)
    @Html.ValidationMessageFor(model => model.CommentDate)
</div>

<div class="editor-label">
    Post
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.PostID, ((IEnumerable<HomePortal.Models.Post>)ViewBag.PossiblePosts).Select(option => new SelectListItem {
        Text = (option == null ? "None" : option.Title), 
        Value = option.ID.ToString(),
        Selected = (Model != null) && (option.ID == Model.PostID)
    }), "Choose...")
    @Html.ValidationMessageFor(model => model.PostID)
</div>
